package com.tiger.statelesssb.sample5;

import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;

public class Sample5Client {
	public static void main(String args[]) {
		try {
			InitialContext ctx = new InitialContext();
			Object obj = ctx.lookup("comp/env/ejb/SimpleStatelessSBBean");
			SimpleStatelessSBHome simpleStatelessSBHome = (SimpleStatelessSBHome) PortableRemoteObject.narrow(obj, SimpleStatelessSBHome.class);

			// ひとつめのステートレスセッションBean
			SimpleStatelessSB simpleStatelessSB1 = simpleStatelessSBHome.create();
			simpleStatelessSB1.businessMethod();
			simpleStatelessSB1.remove();

			// ふたつめのステートレスセッションBean
			SimpleStatelessSB simpleStatelessSB2 = simpleStatelessSBHome.create();
			simpleStatelessSB2.businessMethod();
			simpleStatelessSB2.remove();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
